import Vue from 'vue'
import Router from 'vue-router'

const _import = require('./_import_' + process.env.NODE_ENV)
// in development env not use Lazy Loading,because Lazy Loading too many pages will cause webpack hot update too slow.so only in production use Lazy Loading

/* layout */
import Layout from '../views/layout/Layout'
import AppMain from '../views/layout/AppMain'

Vue.use(Router)

/**
 * icon : the icon show in the sidebar
 * hidden : if `hidden:true` will not show in the sidebar
 * redirect : if `redirect:noredirect` will not redirct in the levelbar
 * noDropdown : if `noDropdown:true` will not has submenu in the sidebar
 * meta : `{ role: ['admin'] }`  will control the page role
 **/
export const constantRouterMap = [
  {path: '/login', component: _import('login/index'), hidden: true},
  {
    path: '/',
    component: Layout,
    redirect: '/dashboard',
    name: 'Dashboard',
    hidden: true,
    children: [{path: 'dashboard', component: _import('dashboard/index')}]
  },
  /*硅棒信息导入*/
  {
    path: '/silicon_rod',
    component: Layout,
    menuId: 1,
    parentId: 0,
    redirect: 'noredirect',
    name: '硅棒信息',
    icon: 'zlgl',
    children: [
      {path: 'siliconInfor_import',menuId: 4,parentId: 1, name: '硅棒信息导入', icon: 'zonghe', component: _import('silicon_rod/siliconInfor_import')},
      {
        path: '/dialog', name: '信息导入弹框', component: AppMain, hidden:true,
        children: [
          {path: 'inforImport', name: '信息导入', icon: 'zonghe', component: _import('silicon_rod/dialog/inforImport')},
          {path: 'inforDetail', name: '信息详情', icon: 'zonghe', component: _import('silicon_rod/dialog/inforDetail')},
        ]
      }
      // {
      //   path:'inforImport',name:'信息导入',icon:'zonghe',component:_import('silicon_rod/siliconInfor_import')
      // }
    ]
  },
  /*报表*/
  {
    path: '/report',
    component: Layout,
    menuId: 2,
    parentId: 0,
    redirect: 'noredirect',
    name: '报表统计',
    icon: 'tjfx',
    children: [
      {
        path: '/detailedReport', name: '明细报表', component: AppMain,
        children: [
        { path: 'forms', menuId: 1, parentId: 1, name: '明细表', icon: 'zonghe', component: _import('report/forms')},
        { path: 'singleCrystal', menuId: 2, parentId: 1, name: '单晶流转概况', icon: 'zonghe', component: _import('report/singleCrystal')},
        { path: 'materialBanlance', menu: 3, parentId: 1, name: '物料平衡表', icon: 'zhonghe', component: _import('report/materialBalance')},
        { path: 'printing', menuId: 4, parentId: 1, name: '扫码打印', icon: 'zonghe', component: _import('report/printing')},
        { path: 'incomingQualityControl', menuId: 5, parentId: 1, name: '来料检验', icon: 'zonghe', component: _import('report/incomingQualityControl')},
        { path: 'stickRecord', menuId: 6, parentId: 1, name: '粘棒记录', icon: 'zonghe', component: _import('report/stickRecord')},
        { path: 'degum', menuId: 7, parentId: 1, name: '脱胶操作', icon: 'zonghe', component: _import('report/degum')},
        { path: 'wireStick', menuId: 8, parentId: 1, name: '线切操作', icon: 'zonghe', component: _import('report/wireStick')},
        { path: 'illustration', menuId: 9, parentId: 1, name: '插片操作', icon: 'zonghe', component: _import('report/illustration')},
        { path: 'rinse', menuId: 10, parentId: 1, name: '清洗操作', icon: 'zonghe', component: _import('report/rinse')},
        { path: 'finaltest', menuId: 11, parentId: 1, name: '最终检验', icon: 'zonghe', component: _import('report/finaltest')},
        { path: 'finaltest_detail', menuId: 12, parentId: 1, name: '最终检验详情', icon: 'zonghe', component: _import('report/finaltest_detail'), hidden: true },
        ]
      },
      {
        path: '/productionReport', name: '产量报表', component: AppMain,
        children: [
          { path: 'linecutOutput', menuId: 13, parentId: 1, name: '线切报表', icon: 'zonghe', component: _import('report/productionReport/linecutOutput')},
        ]
      },
      {
        path: '/qualityReport', name: '质量报表', component: AppMain,
        children: [
          { path: 'qualificationRate', name: '成品合格率', icon: 'zhonge', component: _import('report/qualityReport/qualificationRate')},
          { path: 'defectDistribution', name: '成品缺陷分布', icon: 'zhonge', component: _import('report/qualityReport/defectDistribution')}
        ]
      }
    ]
  },
  /*看板*/
  {
     path: '/kanban',
     component: Layout,
     menuId: 4,
     parentId: 0,
     redirect: 'noredirect',
     name: '看板',
     icon: 'sbgl',
     children: [
      {path: 'kanban', menuId: 11,parentId: 4,name: '看板', icon: 'zonghe', component: _import('kanban/kanban')},
     ]
   },
  /*基础信息*/
  {
    path: '/system',
    component: Layout,
    menuId: 3,
    parentId: 0,
    redirect: 'noredirect',
    name: '系统管理',
    icon: 'xtgl',
    children: [
      {path: 'user', menuId: 7,parentId: 3,name: '用户管理', icon: 'zonghe', component: _import('user/user')},
      {path: 'role', menuId: 8,parentId: 3,name: '角色管理', icon: 'zonghe', component: _import('user/role')},
      {path: 'menu', menuId: 9,parentId: 3,name: '菜单管理', icon: 'zonghe', component: _import('user/menu')},
      {path: 'department',menuId: 10, parentId: 3,name: '部门管理', icon: 'zonghe', component: _import('user/department')},
      {path: 'dictionary', menuId: 11,parentId: 3,name: '字典管理', icon: 'zonghe', component: _import('user/dictionary')},
     /* {path: 'module', name: '模块管理', icon: 'zonghe', component: _import('user/module')},
      {path: 'data', name: '数据权限', icon: 'zonghe', component: _import('user/data')},
      {path: 'cache', name: '缓存管理', icon: 'zonghe', component: _import('user/cache')},
      {path: 'log', name: '日志管理', icon: 'zonghe', component: _import('user/log')},
      {path: 'icon', name: '图表管理', icon: 'zonghe', component: _import('user/icon')},*/

    ]
  },
    /*工艺管理*/
  // {
  //    path:'/process',
  //    component:Layout,
  //    name:'工艺管理',
  //    icon:'gygl',
  //    menuId:5,
  //    parentId:0,
  //    redirect:'noredirect',
  //    children:[
  //       {path:'materialTypes',menuId:12,parentId:5,name:'物料种类',icon:'zonghe',component:_import('process/materialTypes')},
  //       {path:'path',menuId:13,parentId:5,name:'工艺路径',icon:'zonghe',component:_import('process/path')},
  //       {path:'procedure',menuId:14,parentId:5,name:'工序工步',icon:'zonghe',component:_import('process/procedure')},
  //       {path:'technicsBOM',menuId:15,parentId:5,name:'工艺BOM',icon:'zonghe',component:_import('process/technicsBOM')},
  //       {path:'BOMlist',menuId:16,parentId:5,name:'BOM清单',icon:'zonghe',component:_import('process/BOMlist')}


  //    ]
  // },
  // /*计划管理*/
  // {
  //    path:'/plan',
  //    component:Layout,
  //    name:'计划管理',
  //    icon:'scpcgl',
  //    menuId:6,
  //    parentId:0,
  //    redirect:'noredirect',
  //    children:[
  //       {path:'workoutPlan',menuId:17,parentId:6,name:'计划制定',icon:'zonghe',component:_import('plan/workoutPlan')},
  //       {path:'followingPlan',menuId:18,parentId:6,name:'计划跟踪',icon:'zonghe',component:_import('plan/followingPlan')}


  //    ]
  // },

  //   /*生产排程*/
  // {
  //    path:'/scheduling',
  //    component:Layout,
  //    name:'生产排程',
  //    icon:'gcjm',
  //    menuId:7,
  //    parentId:0,
  //    redirect:'noredirect',
  //    children:[
  //       // {path:'workoutPlan',menuId:19,parentId:7,name:'计划制定',icon:'zonghe',component:_import('plan/workoutPlan')},
  //       {path:'followingPlan',menuId:20,parentId:7,name:'计划跟踪',icon:'zonghe',component:_import('scheduling/scheManage')}


  //    ]
  // },

  {path: '*', redirect: '/404', hidden: true}
];

export default new Router({
  // mode: 'history', //后端支持可开
  scrollBehavior: () => ({y: 0}),
  routes: constantRouterMap
})
